﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIG.DAL.Dapper.Model
{

    /// <summary>
    /// A class which represents the Products table.
    /// </summary>
    [Table("ProductSet")]
    public partial class Product
    {
        [Key]
        public virtual int Id { get; set; }
        public virtual string ProductNo { get; set; }
        public virtual string ProductName { get; set; }
        public virtual string Description { get; set; }
        public virtual string Body { get; set; }
        public virtual string Parameters { get; set; }
        public virtual string Thumbnail { get; set; }
        public virtual string ImageUrl { get; set; }
        public virtual string CategoryIds { get; set; }
        public virtual string CreatedBy { get; set; }
        public virtual DateTime CreatedDate { get; set; }
        public virtual string UpdatedBy { get; set; }
        public virtual DateTime? UpdatedDate { get; set; }
        public virtual int ViewCount { get; set; }
        public virtual string Keywords { get; set; }
        public virtual string ViewImage { get; set; }
        public virtual bool Active { get; set; }
        public virtual bool Recommend { get; set; }
        public virtual IEnumerable<Technology> Technologies { get; set; }
        public virtual IEnumerable<Category> Categories { get; set; }
        [Editable(false)]
        public string CategoryTitle
        {
            get
            {
                if (this.Categories != null)
                {
                    string[] q = (from i in this.Categories
                                  select i.Title).ToArray();
                    return string.Join("、", q);
                }

                return string.Empty;
            }

        }
    }
}
